
/*
{
"状态":1,
"名称":"修改-表结构管理字段列",
"作者":"马学兵",
"创建时间":"2018-07-23",
"功能":"修改-",
"log": [
	{"date":"" , "dev" :"" , "content" : ""}
]
}
*/


DECLARE @columns_key int
DECLARE @table_key int
DECLARE @colorder smallint
DECLARE @colname varchar(255)
DECLARE @col_des varchar(500)
DECLARE @datatype varchar(100)
DECLARE @collength smallint
DECLARE @scale smallint
DECLARE @isidentity bit
DECLARE @iskey bit
DECLARE @isnullable bit
DECLARE @defvalue varchar(200)
DECLARE @memo varchar(4000)

Set @columns_key='{columns_key}'
Set @table_key='{table_key}'
Set @colorder='{colorder}'
Set @colname='{colname}'
Set @col_des='{col_des}'
Set @datatype='{datatype}'
Set @collength='{collength}'
Set @scale='{scale}'
Set @isidentity='{isidentity}'
Set @iskey='{iskey}'
Set @isnullable='{isnullable}'
Set @defvalue='{defvalue}'
Set @memo='{memo}'

if isnull(@colorder,0)=0
begin 
	RAISERROR ('SQL:序号不允许为空', 16 ,1 ) ; 
	return 
end 


if isnull(@colname,'')=''
begin 
	RAISERROR ('SQL:列明不允许为空', 16 ,1 ) ; 
	return 
end 

if isnull(@col_des,'')=''
begin 
	RAISERROR ('SQL:描述不允许为空', 16 ,1 ) ; 
	return 
end 

if isnull(@datatype,'')=''
begin 
	RAISERROR ('SQL:数据类型不允许为空', 16 ,1 ) ; 
	return 
end 



UPDATE [y_columns] SET 
table_key=@table_key
,colorder=@colorder
,colname=@colname
,col_des=@col_des
,datatype=@datatype
,collength=@collength
,scale=@scale
,isidentity=@isidentity
,iskey=@iskey
,isnullable=@isnullable
,defvalue=@defvalue
,memo=@memo
WHERE columns_key=@columns_key
